<template>
	<view>
		<view class="shop_t">
			<view @click="change(1)" :class="typechang == 1?'ats':'ts'">
				我发起的
			</view>
			<view @click="change(2)" :class="typechang == 2?'ats':'ts'">
				我助力的
			</view>
		</view>
		<view class="" v-if='typechang == 1 '>
			<view class="ites"
			 :class="item.success==0?'ites':'itesact'"
			 v-for="(item,index) in uuList" :key="index">
				<view class="ites_t">
					<view class="">下单成功立减{{item.couponAmount}}元</view>
					<view class="ites_t_r">{{item.createTime}} 发起</view>
				</view>
				<view class="imgs">
					<view class="" v-if="item.infoList">
						<image v-for="i in item.infoList" :key="i" 
						:src="i.createUserHead?i.createUserHead:'/static/toux.png'" mode=""></image>
						
						
						<image v-for="img in (item.userCount-item.infoList.length)" :key="img" src="../static/user/f9.png" mode=""></image>
					</view>
					
					<view class="imgs_r">
						<span v-if="item.success == '0'">等待好友助力</span>
						<span v-else>好友助力成功</span>
					</view>
				</view>
			</view>
		</view>
		<view class=""v-if='typechang == 2'>
			<view class="ites itesact" v-for="(item,index) in uuList" :key="index">
				<view class="" >
					<view class="ites_t" >
						<view class="">发起人</view>
						<view class="ites_t_r">{{item.createTime}} 助力</view>
					</view>
					<view class="imgs">
						<view class="" style="display: flex;align-items: center;">
							<image :src="item.inviteUserHead?item.inviteUserHead:'/static/toux.png'" mode=""></image>
							
							<view class="" style="color: #000;font-size: 28rpx;margin-left: 16rpx;">
								{{item.inviteUserName}}
							</view>
						</view>
						<view class="imgs_r">
							助力成功
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="kong" v-if="uuList.length == 0">
			<view class="">
				<image src="/static/user/f4.png" mode=""></image>
				<view class="ts">
					{{typechang==1?'尚无邀请记录':'尚无助力记录'}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		yqList,
		zlList
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				uuList:[],
				typechang:1,
				params:{
					pageNum: 1,
					pageSize: 10
				}
			};
		},
		onLoad() {
			yqList(this.params).then(res => {
				if(res.code == 200){
					this.uuList = res.rows
				}
			})
		},
		onReachBottom() {
			this.params.pageNum ++
			yqList(this.params).then(res => {
				if(res.code == 200){
					this.uuList.push(...res.rows)
				}
			})
		},
		methods:{
			change(type){
				this.typechang = type
				this.uuList = []
				this.params.pageNum =1
				if (type == 1) {
					yqList({}).then(res => {
						this.uuList = res.rows
					})
				} else {
					zlList({}).then(res => {
						this.uuList = res.rows
					})
				}
			}
		}
	}
</script>

<style lang="scss">

	.kong {
		width: 100%;
		margin: 230rpx auto;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		image {
			width: 228rpx;
			height: 228rpx;
		}

		.ts {
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #000000;
		}
	}

	.shop_t {
		display: flex;
		background: #fff;
		padding-top: 10rpx;
		position: sticky;
		top: 0%;
		z-index: 9;
		.ts {
			width: 50%;
			text-align: center;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #979797;
			padding-bottom: 20rpx;
			border-bottom: 2px solid #E6E6E6;
		}

		.ats {
			width: 50%;
			text-align: center;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #000000;
			padding-bottom: 20rpx;
			border-bottom: 2px solid #000000;
		}
	}
	
	
	
	.ites {
		width: 710rpx;
		height: 160rpx;
		background: #000000;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 26rpx 20rpx;
		box-sizing: border-box;
		color: #ffffff;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		margin: 20rpx auto;
	
		.ites_t {
			font-size: 28rpx;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
	
		.ites_t_r {
			font-size: 20rpx;
			color: #979797;
			line-height: 23rpx;
		}
	
		.imgs {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 10rpx;
			image {
				width: 60rpx;
				height: 60rpx;
				border-radius: 30rpx;
				margin-right: 15rpx;
			}
	        .imgs_re{
				position: relative;
				image {
					width: 60rpx;
					height: 60rpx;
					border-radius: 30rpx;
				}
				button{
					position: absolute;
					width: 60rpx;
					height: 60rpx;
					border-radius: 30rpx;
					top: 0%;
					opacity: 0.1;
				}
			}
			.imgs_r {
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 20rpx;
				color: #29A85C;
				line-height: 23rpx;
			}
		}
	}
	
	.itesact {
		background: #F3F3F3;
	
		.ites_t {
			color: #000;
		}
	}
</style>
